package net.begincode.blog.enums;

import org.apache.commons.lang3.StringUtils;

public enum UserFlagEnum {
    CREATE("CREATE", "创建"),
    EFFECT("EFFECT", "有效"),
    UNEFFECT("UNEFFECT", "无效"),
    FROZEN("FROZEN", "冻结"),
    DELETE("DELETE", "删除");

    private String flagCode;
    private String flagMsg;

    UserFlagEnum(String flagCode, String flagMsg) {
        this.flagCode = flagCode;
        this.flagMsg = flagMsg;
    }

    public String getFlagCode() {
        return flagCode;
    }

    public void setFlagCode(String flagCode) {
        this.flagCode = flagCode;
    }

    public String getFlagMsg() {
        return flagMsg;
    }

    public void setFlagMsg(String flagMsg) {
        this.flagMsg = flagMsg;
    }

    public static boolean checkIn(String flag) {
        UserFlagEnum[] userFlagEnums = UserFlagEnum.values();
        for (UserFlagEnum userFlagEnum : userFlagEnums) {
            if (StringUtils.equals(userFlagEnum.getFlagCode(), flag)) {
                return true;
            }
        }
        return false;
    }
}
